#include"WPILib.h"

#ifndef SHOOTERENCODER_H_
#define SHOOTERENCODER_H_

/**
 * Creating an "encoder" for the flywheel, 
 * which is going to be an ir break that 
 * we keep track of. This will track the 
 * number of revolutions and the period 
 * (both of which are synchronous, so we 
 * have to call the update function 
 * frequently. 
 */

class ShooterEncoder : public Counter, public PIDSource
{
	float sampledRPSs[12];
	float averageRPS;
	int samplerIndex;
	
	float lastTime;
	
	void UpdateAverageRPS();
	double GetPPCTimestampFine();
	double GetTurnsPerTime();
	
public:
	
	ShooterEncoder(int channel);
	virtual ~ShooterEncoder();
	double GetAverageRPS();
	
	double PIDGet();
	
	void Update();
};

// Code to make the timestamp function work.
extern "C"
{
	UINT32 niTimestamp32(void);
	UINT64 niTimestamp64(void);
}

#endif
